﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Web;
using DHQGHN.DAL.Models.TDT;

namespace DHQGHN.Services.TDT
{
    [ServiceContract]
    public interface IResidentService
    {

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetByID/{residentID}"
            )]
        DAL.Models.TDT.RESIDENT GetByID(string residentID);
        /// <summary>
        /// Trả về danh sách công dân theo mã Địa bàn điều tra
        /// </summary>
        /// <param name="eaCode"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIdx"></param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(ResponseFormat=WebMessageFormat.Json, BodyStyle=WebMessageBodyStyle.Bare,
            UriTemplate = "GetByAreaCode/{areaCode}/{pageSize}/{pageIdx}")]
        IEnumerable<DAL.Models.TDT.RESIDENT> GetByAreaCode(string areaCode, string pageSize, string pageIdx);
        /// <summary>
        /// Trả về danh sách công dân theo mã ĐVHC cấp xã/phường
        /// </summary>
        /// <param name="commnuneCode"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIdx"></param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetByCommuneCode/{commnuneCode}/{pageSize}/{pageIdx}")]
        IEnumerable<DAL.Models.TDT.RESIDENT> GetByCommuneCode(string commnuneCode, string pageSize, string pageIdx);
        /// <summary>
        /// Thêm mới thông tin cư dân
        /// </summary>
        /// <param name="resident"></param>
        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "AddResident")]
        void AddResident(DAL.Models.TDT.RESIDENT resident);
        /// <summary>
        /// Xóa thông tin cư dân
        /// </summary>
        /// <param name="residentID"></param>
        [OperationContract]
        [WebInvoke(Method = "DELETE",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "DeleteResident")]
        void DeleteResident(string residentID);
        /// <summary>
        /// Cập nhật thông tin Cư dân
        /// </summary>
        /// <param name="resident"></param>
        [OperationContract]
        [WebInvoke(Method = "PUT",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "EditResident")]
        void EditResident(DAL.Models.TDT.RESIDENT resident);



        /// <summary>
        /// Trả về danh sách công dân theo mã hộ
        /// </summary>
        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetByHouseHoldID/{houseHoldId}")]
        IEnumerable<DAL.Models.TDT.RESIDENT> GetByHouseHoldID(string houseHoldId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetByHouseHoldIDForPM3/{houseHoldId}/{residentID}")]
        IEnumerable<DAL.Models.TDT.PM3_RESIDENT> GetByHouseHoldIDForPM3(string houseHoldId, string residentID);
    }
}